package comparator;

import java.util.Comparator;

import bean.rule.RuleCondition;

public class CriticalityComparator implements Comparator<RuleCondition> {

	@Override
	public int compare(RuleCondition arg0, RuleCondition arg1) {
		
		
		if(arg0.getCriticality() > arg1.getCriticality()){
			//System.out.println(arg0 + "----" + arg1 + "Greater");
			return -1;
		}
		else if(arg0.getCriticality() == arg1.getCriticality()){
			//System.out.println(arg0 + "----" + arg1 + "Equal");
			return arg0.getParameter().compareToIgnoreCase(arg1.getParameter());
		}else if(arg0.getCriticality() < arg1.getCriticality()){
			//System.out.println(arg0 + "----" + arg1 + "Lesser");
			return 1;
		}
		
		return 0;
		
	}

}
